package cn.hackcloud.mutithread.mutilthread.notifyholdlock;

public class Service {
	public void test(Object lock) {
		try {
			synchronized (lock) {
				System.out.println("begin wait");
				lock.wait();
				System.out.println("end wait");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void notify(Object lock) {
		try {
			synchronized (lock) {
				System.out.println("begin notify");
				lock.notify();
				System.out.println("end notify");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		Object object = new Object();
		ThreadA threadA = new ThreadA(object);
		threadA.start();
		ThreadB threadB = new ThreadB(object);
		threadB.start();
	}
}
